<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	<title>登录 - 金车二手车</title>
	<meta content="金车二手车" name="keywords" />
	<meta content="金车二手车" name="description" />
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="iconfont/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="css/style.css" />
	<script type="text/javascript" src="script/jquery.js"></script>
	<script type="text/javascript" src="js/mui.js"></script>
	<script type="text/javascript" src="script/bootstrap.min.js"></script>
	<script type="text/javascript" src="script/Validform_v5.3.2_min.js"></script>
	<script type="text/javascript" src="script/layer.mobile/layer.js"></script>
	<script type="text/javascript" src="script/TouchSlide.1.1.js"></script>
	<script type="text/javascript">
		$(document).ready(function () {
			//表单验证
			$(".form-horizontal").Validform({
				tiptype: function (msg, o, cssctl) {
					var objtip = $("#regnotice");
					cssctl(objtip, o.type);
					objtip.text(msg);
				}
			});
		});
	</script>
</head>

<body>
	<div id="brand-box">
		<header class="mo-header">
			<div class="mo-header-left">
				<a href="#">金车 </a>
			</div>
		</header>
	</div>
	<div class="container mt20">
		<div class="login_main">
			<div class="mt20">
				<form name="loginform" class="form-horizontal" method="post" action="#">
					<div class="form-group">
						<div class="col-xs-10 col-xs-offset-1">
							<div id="regnotice" class="lognotice"></div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-xs-10 col-xs-offset-1">
							<input type="text" class="form-control telephone" placeholder="请输入手机号" id="mobilephone" name="mobilephone"
								datatype="m" sucmsg="手机号验证通过！" nullmsg="请输入手机号！" errormsg="请输入正确的手机号！" />
						</div>
					</div>
					<!-- <div class="form-group"> 
        <div class="col-xs-10 col-xs-offset-1"> 
          <input type="text" class="form-control password" placeholder="请输入密码" name="password" nullmsg="请输入密码！"/> 
        </div> 
      </div> -->
					<div class="form-group">
						<div class="col-xs-5 col-xs-offset-1">
							<input type="text" placeholder="请输入验证码" class="form-control" name="authcode" id="authcode"
								nullmsg="请输入验证码！" errormsg="请输入正确的验证码！" />
						</div>
						<div class="col-xs-5">
							<input type="button" value="获取验证码" class="btn btn-default btn-block" id="sendmsg">
						</div>
					</div>
					<div class="form-group">
						<div class="col-xs-10 col-xs-offset-1">
							<input type="checkbox" id="agreement" />我已阅读并同意<a href="agreement.html">用户协议</a>
						</div>
					</div>
					<div class="form-group">
						<div class="col-xs-10 col-xs-offset-1">
							<input type="submit" value="注册/登 录" onclick="login();return false;" class="btn btn-danger btn-block" />
						</div>
						<!-- <div class="col-xs-5"> 
        <a href="#" onclick="registerpage();return false;" class="btn btn-default btn-block">注册</a> 
       </div> -->
					</div>
				</form>
			</div>
		</div>
	</div>
	<!--内容-->
	<!--<a href="javascript:;" id="returntop"></a>-->
	<script type="text/javascript" src="script/jquery.lazyload.js"></script>
	<script>
		$(function () {
			var telephone = window.localStorage.getItem("telephone");
			if (typeof telephone !== "object") {
				window.location.href = "index1.html";
			}
		})
	</script>
	<script>
		function login() {
			if ($('#agreement').is(':checked') == false) {
				plus.nativeUI.toast('请先阅读并同意用户协议！');
				return;
			}
			if ($('#authcode').val() == "") {
				plus.nativeUI.toast('验证码不能为空！');
				return;
			}
			$.ajax({
				type: "post",
				url: servicePath + "sechandcar/app/users/shcUser/login",
				async: false,
				data: {
					"telephone": $(".telephone").val(),
					"sendmsg": $("#authcode").val()
				},
				success: function (data) {
					// window.alert(data);
					if (data == 'success') {
						//alert(1);
						var storage = window.localStorage;
						storage["a"] = 1;

						var telephone = $(".telephone").val();
						//window.localStorage.setItem("telephone", telephone);
						//alert(telephone);

						$.ajax({
							type: "post",
							url: servicePath + "sechandcar/app/users/shcUser/selectMyImgsrc",
							data: {
								"telephone": $(".telephone").val()
							},
							dataType: "json",
							async: false,
							success: function (data) {

								//var a = eval("("+data+")");
								//window.alert(data); 
								//  alert(data);
								// alert(data.id)
								window.localStorage.setItem("id", data.id);
								window.localStorage.setItem("nickname", data.nickname);
								window.localStorage.setItem("telephone", data.telephone);
								window.localStorage.setItem("vipdate", data.vipdate);
								window.localStorage.setItem("type", data.type);
								window.localStorage.setItem("useflag", data.useflag);
								window.localStorage.setItem("image", data.image);
								window.localStorage.setItem("user", "(" + data + ")");
								// alert(window.localStorage.getItem("telephone"));
								window.location.href = "index1.html";

							},
							error: function (data) {
								//console.log(data);
								window.alert(data);
							},
						});
						// window.location.href='nickname.html';
					} else if (data == 'errcode') {
						plus.nativeUI.toast('验证码错误！');
					} else if (data == "disable") {
						plus.nativeUI.toast('您的账号已被禁用!');
					} else {
						//window.location.href='nicheng.html?telephone='+$(".telephone").val();
						//window.location.href = "index1.html";
					}
				},
				error: function (data) {
					//console.log(data);
					//window.alert(data);
				}
			});
		}
	</script>
	<script>
		function registerpage() {
			//alert($(".telephone").val());
			$.ajax({
				type: "post",
				url: servicePath + "sechandcar/app/users/shcUser/registerpage",
				//async:false,
				data: {},
				datatype: 'json',
				success: function (data) {
					// window.alert(data);
					if (data == 'success') {
						//alert(1);
						window.location.href = 'register.html';
					}
				},
				error: function (data) {
					//console.log(data);
					//window.alert(data);
				}
			});
		}
		$('#sendmsg').click(function () {
			var telephone = $(".telephone").val();
			if (telephone == '') {
				alert("请输入手机号！");
				return;
			};
			$.ajax({
				type: "post",
				data: {
					telephone: telephone
				},
				url: servicePath + "sechandcar/app/users/shcUser/verifycode",
				datatype: 'json',
				success: function (data) {
					if (data == 'OK') {
						plus.nativeUI.toast('发送成功！');
					} else {
						plus.nativeUI.toast('发送太频繁，稍后再试！');
					}
				},
				error: function (data) {
					alert('失败');
				}
			});
		})
	</script>
</body>

</html>